package tutorial.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2009-11-22 18:14:01")
/** */
public final class TweetMeta extends org.slim3.datastore.ModelMeta<tutorial.model.Tweet> {

    /** */
    public TweetMeta() {
        super("Tweet", tutorial.model.Tweet.class);
    }

    /** */
    public org.slim3.datastore.StringAttributeMeta<tutorial.model.Tweet> content = new org.slim3.datastore.StringAttributeMeta<tutorial.model.Tweet>(this, "content");

    /** */
    public org.slim3.datastore.CoreAttributeMeta<tutorial.model.Tweet, java.util.Date> createdDate = new org.slim3.datastore.CoreAttributeMeta<tutorial.model.Tweet, java.util.Date>(this, "createdDate", java.util.Date.class);

    /** */
    public org.slim3.datastore.CoreAttributeMeta<tutorial.model.Tweet, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<tutorial.model.Tweet, com.google.appengine.api.datastore.Key>(this, "__key__", com.google.appengine.api.datastore.Key.class);

    /** */
    public org.slim3.datastore.CoreAttributeMeta<tutorial.model.Tweet, java.lang.Integer> schemaVersion = new org.slim3.datastore.CoreAttributeMeta<tutorial.model.Tweet, java.lang.Integer>(this, "schemaVersion", java.lang.Integer.class);

    /** */
    public org.slim3.datastore.CoreAttributeMeta<tutorial.model.Tweet, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<tutorial.model.Tweet, java.lang.Long>(this, "version", java.lang.Long.class);

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        tutorial.model.Tweet m = (tutorial.model.Tweet) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        tutorial.model.Tweet m = (tutorial.model.Tweet) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void incrementVersion(Object model) {
        tutorial.model.Tweet m = (tutorial.model.Tweet) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected tutorial.model.Tweet entityToModel(com.google.appengine.api.datastore.Entity entity) {
        tutorial.model.Tweet model = new tutorial.model.Tweet();
        model.setContent((java.lang.String) entity.getProperty("content"));
        model.setCreatedDate((java.util.Date) entity.getProperty("createdDate"));
        model.setKey(entity.getKey());
        model.setSchemaVersion(longToInteger((java.lang.Long) entity.getProperty("schemaVersion")));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    protected com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        tutorial.model.Tweet m = (tutorial.model.Tweet) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setProperty("content", m.getContent());
        entity.setProperty("createdDate", m.getCreatedDate());
        entity.setProperty("schemaVersion", m.getSchemaVersion());
        entity.setProperty("version", m.getVersion());
        return entity;
    }
}